#include<stdio.h>
#include<string.h>
#include "regex_parser.h"
#include "regex_vm.h"

int main(int argc,char **argv){
    unsigned char *s="\\(|\\)|\\[|\\]|\\d+\\.\\d+|\\d+|\\S+";
    ast_node *root= parse_regex(s,strlen(s));
    display_ast(root,0);
    instruction *re = regex_compile(root);
    instruction *t=re;
    while(t->next!=NULL){
        t=t->next;
    }
    t->next=make_instruction(i_match);
    display_instruction(re);
    char *str = "((lambda [x ] (+ x x )) 2)";
    regex_result *ret =  regex_match(re,str,strlen(str));
    display_result(ret);
    return 0;
}
